package cn.itcast.hotel.controller;

import cn.itcast.hotel.pojo.FilterVO;
import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    IHotelService iHotelService;

    @PostMapping("/list")
    public PageResult pageHotel(@RequestBody RequestParams params) {
        return iHotelService.pageQueue(params);
    }
    @PostMapping("/filters")
    public FilterVO filter (@RequestBody RequestParams params)throws IOException {
        FilterVO vo =iHotelService.filter(params);
        return  vo;
    }
}
